//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tools\fn_distTo.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART

private ["_pos1","_pos2","_ret"];
DEFAULT_PARAM(_pos1,0,[]);
DEFAULT_PARAM(_pos2,1,[]);
_ret = -1;
if (IS_OBJECT(_pos1)) then {_pos1 = getpos _pos1} else { _pos1 = +_pos1 };
if (IS_OBJECT(_pos2)) then {_pos2 = getpos _pos2} else { _pos2 = +_pos2 };

if (count _pos1 >= 2 && count _pos2 >= 2) then {
	_pos1 set [2,0];
	_pos2 set [2,0];
	_ret = (_pos1 vectorDistance _pos2);
};
TRACE_1("End",_ret);
TMFPROFILERSTOP
_ret;